const handleNodeNogoging = (dataFinal) => {
  let tempArr = [];
  let innerFn = (dataFinal) => {
    if (!dataFinal || !Object.keys(dataFinal).length) return;
    let {
      childNode: cnFirst,
      conditionNodes: cdFirst,
      nodeId,
      content,
      prevId,
      outgoing,
      outingDeep,
    } = dataFinal;
    if (!cnFirst && !outgoing)
      tempArr.push({
        nodeId,
        content,
        outingDeep,
        prevId,
      });

    if (cnFirst) {
      let r1 = innerFn(cnFirst);
      if (r1) return r1;
    }

    if (cdFirst) {
      for (let c of cdFirst) {
        let r2 = innerFn(c);
        if (r2) {
          return r2;
        }
      }
    }
  };
  innerFn(dataFinal);
  return tempArr;
};

// const handleChild = (childN) => {
//   if (!childN || !Object.keys(childN).length) return;
//   let { childNode: cnSecond, conditionNodes: cdSecond } = childN;
//   if (cnSecond) handleNodeNogoging(cnSecond);
//   if (cdSecond) handleConds(cdSecond);
// };

// const handleConds = (condArrs, topNodeId = "") => {
//   if (!condArrs || !condArrs.length) return;
//   condArrs.forEach((i) => {
//     let { prevId: itemPrevId, childNode: itemcn } = i || {};
//     itemcn;
//   });
// };

module.exports = {
  handleNodeNogoging,
};
